package com.kgc.skconsumer.controller;

import com.kgc.basic.util.ResponseMsg;
import com.kgc.collection.pojo.SalesReceivable;
import com.kgc.skconsumer.feign.SalesReceivableFeign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/SalesReceivableController")
public class SalesReceivableController {

    private Logger logger = LoggerFactory.getLogger(SalesReceivableController.class);


    @Autowired
    private SalesReceivableFeign salesReceivableFeign;


    @RequestMapping("/selectSalesReceivableByPage")
    public ResponseMsg selectSalesReceivableByPage(@RequestBody Map<String, Object> map) {
        logger.info("SalesReceivableController   selectSalesReceivableByPage params is{}",map.toString());
        ResponseMsg responseMsg = salesReceivableFeign.selectSalesReceivableByPage(map);
        logger.debug("SalesReceivableController   selectSalesReceivableByPage response is{}",responseMsg.toString());
        return responseMsg;
    }


    @RequestMapping("/insertSalesReceivable")
    public  ResponseMsg insertSalesReceivable(@RequestBody SalesReceivable salesReceivable) {
        logger.info("SalesReceivableController insertSalesReceivable params is{}",salesReceivable.toString());
        ResponseMsg responseMsg = salesReceivableFeign.insertSalesReceivable(salesReceivable);
        logger.debug("SalesReceivableController insertSalesReceivable response is{}",responseMsg.toString());
        return responseMsg;
    }

    @RequestMapping("/updateSalesReceivable")
    public  ResponseMsg  updateSalesReceivable(@RequestBody SalesReceivable salesReceivable) {
        logger.info("SalesReceivableController updateSalesReceivable params is{}",salesReceivable.toString());
        ResponseMsg responseMsg = salesReceivableFeign.updateSalesReceivable(salesReceivable);
        logger.debug("SalesReceivableController updateSalesReceivable response is{}",responseMsg.toString());
        return responseMsg;
    }

    @RequestMapping("/deleteSalesReceivable")
    public ResponseMsg deleteSalesReceivable(@RequestBody Map<String, Object> map) {
        logger.info("SalesReceivableController deleteSalesReceivable params is{}",map.toString());
        ResponseMsg responseMsg=salesReceivableFeign.deleteSalesReceivable(map);
        logger.info("SalesReceivableController deleteSalesReceivable return is{}",responseMsg);
        return responseMsg;
    }

}
